package com.example.demo.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.demo.annotation.Display;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.sql.Timestamp;
import java.util.List;

@Data
@RequiredArgsConstructor
@TableName(value = "voj_objective_question")
public class VojObjectiveQuestion {

    /**
     * 单选题
     */
    public static final int QUESTION_TYPE_SINGLE_CHOICE = 2;

    /**
     * 多选题
     */
    public static final int QUESTION_TYPE_MULTIPLE_CHOICE = 3;

    /**
     * 判断题
     */
    public static final int QUESTION_TYPE_TURE_OR_FALSE = 4;

    @Display("问题标识")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Display("题目")
    @TableField(value = "title")
    private String title;

    @Display("提示")
    @TableField(value = "hint")
    private String hint;

    @Display("公司所属标识")
    @TableField(value = "company_id")
    private Long companyId;

    @Display("公司所属标识")
    @TableField(value = "disabled")
    private Long disabled;

    @Display("公司所属标识")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "create_time")
    private Timestamp createTime;

    @Display("公司所属标识")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "modify_time")
    private Timestamp modifyTime;

    @Display("创建人")
    @TableField(value = "creator_id")
    private Long creatorId;

    @Display("选项")
    @TableField(exist = false)
    private List<VojObjectiveQuestionOption> options;

    @Display("答案")
    @TableField(exist = false)
    private List<VojObjectiveQuestionAnswer> answers;

    @Display("题型")
    @TableField(value = "question_type")
    private Integer questionType;

}
